cmake_minimum_required(VERSION 3.10)

project(dal_rticonnextdds-test)

include_directories(${PROJECT_SOURCE_DIR}/test_resource/dalidl_generator_cpp)

add_executable(dal_rticonnextdds_test_convert_statusmask
    test_convert_statusmask.cc)

add_executable(dal_rticonnextdds_test_convert_status
    test_convert_status.cc)

add_executable(dal_rticonnextdds_test_convert_qos
    test_convert_qos.cc)

add_executable(dal_rticonnextdds_test_convert_ret_type
    test_convert_ret_type.cc)

add_executable(dal_rticonnextdds_test_convert_instance_handle
    test_convert_instance_handle.cc)

add_executable(dal_rticonnextdds_test_domain_participant
    test_domain_participant.cc)

add_executable(dal_rticonnextdds_test_publisher
    test_publisher.cc)

add_executable(dal_rticonnextdds_test_subscriber
    test_subscriber.cc)

add_executable(dal_rticonnextdds_test_convert_sample_info
    test_convert_sample_info.cc)

add_executable(dal_rticonnextdds_test_convert_guid
    test_convert_guid.cc)

add_executable(dal_rticonnextdds_test_log
    test_log.cc)

add_executable(dal_rticonnextdds_test_identifier
    ${PROJECT_SOURCE_DIR}/../src/dal/identifier.cpp
    test_identifier.cc)

add_executable(dal_rticonnextdds_test_config_loader
    ${PROJECT_SOURCE_DIR}/../src/dal/config_loader.cpp
    test_config_loader.cc) 

set(test_libs gtest gtest_main pthread)

target_link_libraries(dal_rticonnextdds_test_convert_statusmask ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_convert_status ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_convert_qos ${test_libs} dal dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_convert_ret_type ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_convert_instance_handle ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_convert_sample_info ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_convert_guid ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_domain_participant ${test_libs} dal dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_publisher ${test_libs} dal dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_subscriber ${test_libs} dal dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_log ${test_libs})
target_link_libraries(dal_rticonnextdds_test_identifier ${test_libs} dal_rticonnextdds)
target_link_libraries(dal_rticonnextdds_test_config_loader ${test_libs} dal dal_rticonnextdds)

install(TARGETS
        dal_rticonnextdds_test_convert_statusmask dal_rticonnextdds_test_convert_status
        dal_rticonnextdds_test_convert_qos dal_rticonnextdds_test_convert_ret_type
        dal_rticonnextdds_test_convert_instance_handle dal_rticonnextdds_test_convert_sample_info
        dal_rticonnextdds_test_convert_guid 
        dal_rticonnextdds_test_domain_participant
        dal_rticonnextdds_test_publisher 
        dal_rticonnextdds_test_subscriber
        dal_rticonnextdds_test_log 
        dal_rticonnextdds_test_config_loader
        dal_rticonnextdds_test_identifier
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/dal_rticonnextdds/test)

install(DIRECTORY ./test_resource/
        DESTINATION ${CMAKE_INSTALL_BINDIR}/dal_rticonnextdds/test
        FILES_MATCHING PATTERN "*.xml")